package cn.diancan.action.api;

import java.util.List;

import com.opensymphony.xwork2.ModelDriven;

import cn.diancan.action.BaseAction;
import cn.diancan.vo.mobile.ProductApiActionVo;
import cn.diancan.vo.model.ProductVo;


public class ProductAction extends BaseAction implements ModelDriven<ProductApiActionVo>{
    
    private ProductApiActionVo requestVo=new ProductApiActionVo();
    
    
    /**
     * 扫条码读取信息
     * @return
     */
    //@MemberMobileApiAuth
    public String productInfoByBarcode(){
        ProductVo productVo = productService.findVoByBarcode(requestVo.getBarCode());
        return jsonFormat(productVo);
    }
    
    /**
     * 定时更新的数据
     * @return
     */
    //@MemberMobileApiAuth
    public String productList(){  
        try {
            List<ProductVo> list = productService.findVoList(requestVo.getLastUpdateTimeStamp(), requestVo.getPageNo(), requestVo.getRow());
            return jsonFormat(list);
        }   catch (Exception e) {
           return jsonError(e);
        }
    }


    //
    public String goodsProductList(){
        try {
            List<ProductVo> list = productService.findProductVoList(requestVo.getGoodsNumber(), requestVo.getPageNo(), requestVo.getRow());
            return jsonFormat(list);
        }   catch (Exception e) {
            return jsonError(e);
        }
    }
    
    

    @Override
    public ProductApiActionVo getModel() { 
	    return requestVo;
    }

    
    
    
}
